package com.salinity.kun.util;

import java.io.IOException;
import java.nio.file.Path;

public class PathUtil {

	public static void preparePath(Path targetPath){
		if(targetPath.toFile().exists()){
			targetPath.toFile().delete();
		}
 		if(!targetPath.getParent().toFile().exists()){
			targetPath.getParent().toFile().mkdirs();
		}
		try {
			targetPath.toFile().createNewFile();
		} catch (IOException e) {
			System.out.println("Prepare path:"+targetPath+" failure."); 
		 
			throw new RuntimeException(e);
		}
	}
}
